from typing import Mapping
from dataclasses import dataclass
from typing import Optional


@dataclass
class Query:
    module: str
    method: str
    params: Optional[Mapping[str, str]]
    return_column_type_dict: Optional[Mapping[str, str]]
    return_column_name_dict: Optional[Mapping[str, str]]


class HSException(Exception):
    def __init__(self, method, params, status_code, error_code, error_info):  
        self.method = method
        self.params = params
        self.status_code = status_code
        self.error_code = error_code
        self.error_info = error_info

    def __str__(self):
        return f'异常接口：{self.method} 参数：{self.params} HTTP状态码：{self.status_code} error_code：{self.error_code} error_info: {self.error_info}'

    def __repr__(self):
        return f'异常接口：{self.method} 参数：{self.params} HTTP状态码：{self.status_code} error_code：{self.error_code} error_info: {self.error_info}'
